<%-- 
  - Author: Mohtisham.Salahria
  - Date: 27-May-2011
  - Copyright Notice: TRAKHEES
  - Description: list.jsp
 --%>

<%@ include file="/WEB-INF/view/include.jsp"%>
<%@ page import="ae.pcfc.etks.online.web.*"%>


<script type="text/javascript">
	$()
			.ready(
					function() {

						//$("input:submit, input:reset, input:button, input:file").button();

						//$("#accordionSummary").accordion();
						//$("#accordionUserDetails").accordion();

						/*$("#userLockDialog").dialog({autoOpen:false, width: 680});   
						   $("#save").click(function(event){
						      event.preventDefault();
						      $("#userLockDialog").dialog("open");
						   });
						 */

						$("#EditUser")
								.validate(
										{

											onfocusout : false,
											onkeyup : false,
											onclick : false,
											rules : {
												//Step # 1 Rules
												strStatusComments : "required"

											},
											showErrors : function(errorMap,
													errorList) {

												var errors = '<ul>';
												var label;
												if (errorList.length) {
													$.each(errorMap, function(
															name, value) {
														label = $(
																"label[for='"
																		+ name
																		+ "']")
																.html();
														label = value + '['
																+ label + ']';
														errors = errors
																+ '<li>'
																+ label
																+ '</li>';

													});
													errors = errors + '</ul>';
													jAlert('error', errors,
															'<spring:message code="label.errormessage" />');
													return false;
												}
											}

										});

					});
</script>

<div id="container" dir='<spring:message code="page.dir"/>'
	align='<spring:message code="page.align"/>' class="t_form">
	<div class="ui-jqgrid-titlebar ui-widget-header ui-corner-top ui-helper-clearfix"><spring:message code="label.edit.user"/></div>
	<form:form name="EditUser" id="EditUser" method="POST"
		modelAttribute="<%=ConstantsAdmin.ADMIN_UPDATE_USER_MODEL_KEY %>">
		<spring:hasBindErrors
			name="<%=ConstantsAdmin.ADMIN_UPDATE_USER_MODEL_KEY %>">
			<script type="text/javascript">
				$(document)
						.ready(
								function() {
									jAlert(
											'error',
											'<li><form:errors path="*" delimiter="<li>"/>',
											'<spring:message code="label.errormessage" />');
								});
			</script>
		</spring:hasBindErrors>

		<%
			if (request.getAttribute(ConstantsAdmin.SUCCESS_PARAM) != null) {
		%>
		<script type="text/javascript">
	
			$(document)
					.ready(
							function() {
								jAlert(
										'success',
										'<%=request.getAttribute(ConstantsAdmin.SUCCESS_PARAM)%>',
										'');
							});
			</script>
		<%
			}
		%>

		<fieldset>
			<legend>
				<spring:message code="label.client.summary.info" />
			</legend>
		</fieldset>
		<div id="accordionSummary">
			<div class="t_fin-black-txt  t_form-left">
				<c:if
					test="${null != clientCompanySummary  and not empty clientCompanySummary}">
					<div>
						<label> <spring:message code="label.company.nameeng" /> </label>
						<input disabled="disabled"
							value='<c:out value="${clientCompanySummary.strNameENG}"></c:out>'>
					</div>
					<div>
						<label> <spring:message code="label.company.namearab" />
						</label><input disabled="disabled"
							value='<c:out value="${clientCompanySummary.strNameARB}"></c:out>'>
					</div>
					<div>
						<label> <spring:message code="label.company.telnooffice" />
						</label><input disabled="disabled"
							value='<c:out value="${clientCompanySummary.strOfficeNo}"></c:out>'>
					</div>
					<div>
						<label> <spring:message code="label.company.role" /> </label> <select
							disabled="disabled" multiple="multiple" style="float: none;">
							<c:forEach items="${clientCompanySummary.SCClientCompanyRoleVO}"
								var="clientRole" varStatus="loop">
								<c:if test="${loop.index > 0 }">
									<c:out value=""></c:out>
								</c:if>
								<c:choose>
									<c:when
										test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
										<option>
											<c:out value="${clientRole.clientRoleArb}"></c:out>
										</option>
									</c:when>
									<c:otherwise>
										<option>
											<c:out value="${clientRole.clientRoleEng}"></c:out>
										</option>
									</c:otherwise>
								</c:choose>
							</c:forEach>
						</select>
					</div>

					<div>
						<label> <spring:message code="label.company.emailaddress" />
						</label><input disabled="disabled"
							value='<c:out value="${clientCompanySummary.strEmail}"></c:out>'>
					</div>

					<div>
						<label> <spring:message code="label.company.websiteurl" />
						</label><input disabled="disabled"
							value='<c:out value="${clientCompanySummary.strWebsite}"></c:out>'>
					</div>
					
					<div>
						<span><b><spring:message code="label.company.licenseinfo" /></b></span><br/>
						<div>
							<label> <spring:message code="label.company.lia" /> </label><input
								disabled="disabled"
								value='<c:out value="${clientCompanySummary.strLicenseIssuingAuth}"></c:out>'>
						</div>

						<div>
							<label> <spring:message code="label.company.lno" /> </label><input
								disabled="disabled"
								value='<c:out value="${clientCompanySummary.strLicenseNumber}"></c:out>'>
						</div>

						<div>
							<label> <spring:message code="label.company.lid" /> </label><input
								disabled="disabled"
								value='<fmt:formatDate pattern="dd-MM-yyyy"  value="${clientCompanySummary.strLicenseIssueDate}"></fmt:formatDate>'>
						</div>

						<div>
							<label> <spring:message code="label.company.led" /> </label><input
								disabled="disabled"
								value='<fmt:formatDate pattern="dd-MM-yyyy" value="${clientCompanySummary.strLicenseExpiryDate}"></fmt:formatDate>'>
						</div>
					</div>
				</c:if>
				<c:if
					test="${null != clientPersonSummary  and not empty clientPersonSummary}">

					<div>
						<label> <spring:message
								code="label.nonclient.person.register.nameENG" /> </label><input
							disabled="disabled"
							value='<c:out value="${clientPersonSummary.strNameENG}"></c:out>'>
					</div>
					<div>
						<label> <spring:message
								code="label.nonclient.person.register.nameARB" /> </label><input
							disabled="disabled"
							value='<c:out value="${clientPersonSummary.strNameARB}"></c:out>'>
					</div>
					<div>
						<label> <spring:message
								code="label.nonclient.person.register.telNoHome" /> </label><input
							disabled="disabled"
							value='<c:out value="${clientPersonSummary.strHomeTel}"></c:out>'>
					</div>
					<div>
						<label> <spring:message code="label.company.role" /> </label> <select
							disabled="disabled" multiple="multiple" style="float: none;">
							<c:forEach items="${clientPersonSummary.SCClientPersonRoleVO}"
								var="clientRole" varStatus="loop">
								<c:if test="${loop.index > 0 }">
									<c:out value=""></c:out>
								</c:if>
								<c:choose>
									<c:when
										test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
										<option>
											<c:out value="${clientRole.clientRoleArb}"></c:out>
										</option>
									</c:when>
									<c:otherwise>
										<option>
											<c:out value="${clientRole.clientRoleEng}"></c:out>
										</option>
									</c:otherwise>
								</c:choose>
							</c:forEach>
						</select>
					</div>
					<div>
						<label> <spring:message
								code="label.nonclient.person.register.mobNo1" /> </label><input
							disabled="disabled"
							value='<c:out value="${clientPersonSummary.strMobile1}"></c:out>'>
					</div>

					<div>
						<label> <spring:message
								code="label.nonclient.person.register.emailAddress" /> </label><input
							disabled="disabled"
							value='<c:out value="${clientPersonSummary.strEmail}"></c:out>'>
					</div>

					<div>
						<label> <spring:message
								code="label.nonclient.person.register.websiteURL" /> </label><input
							disabled="disabled"
							value='<c:out value="${clientPersonSummary.strWebsite}"></c:out>'>
					</div>
				</c:if>

			</div>
		</div>
		<fieldset>
			<legend>
			<spring:message code="label.login.details" />
			</legend>
		</fieldset>

		<div id=accordionUserDetails>
			<div class="t_fin-black-txt t_form-left">
				<div>
					<form:label path="strUserName">
						<spring:message code="label.adminname.eng" />
					</form:label>
					<form:input path="strUserName" id="strUserName" size="30"
						maxlength="100" readonly="true" class="t_form-fld-disable" />
				</div>
				<div>
					<form:label path="strUserNameArab">
						<spring:message code="label.adminname.arab" />
					</form:label>
					<form:input path="strUserNameArab" id="strUserNameArab" size="30"
						maxlength="100" readonly="true" class="t_form-fld-disable" />
				</div>
				<div>
					<form:label path="strUsrName">
						<spring:message code="label.username" />
					</form:label>
					<form:input path="strUsrName" id="strUsrName" size="30"
						maxlength="100" readonly="true" class="t_form-fld-disable" />
				</div>
				<div>
					<form:label path="iSecretAnsId">
						<spring:message code="label.secretquestion" />
					</form:label>
					<c:choose>
						<c:when
							test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
							<form:select path="iSecretAnsId" items="${userSecretQuestion}"
								id="iSecretAnsId" itemLabel="labelAr" itemValue="id"
								disabled="true"
								class="fm-opt" />
						</c:when>
						<c:otherwise>
							<form:select path="iSecretAnsId" items="${userSecretQuestion}"
								id="iSecretAnsId" itemLabel="labelEn" itemValue="id"
								disabled="true"
								class="fm-opt" />
						</c:otherwise>
					</c:choose>

				</div>
				<div>
					<form:label path="strSecretAns">
						<spring:message code="label.anstosecretquestion" />
					</form:label>
					<form:input path="strSecretAns" id="strSecretAns" size="30"
						maxlength="100" readonly="true" class="t_form-fld-disable" />

				</div>
				<div>
					<form:label path="strEmail">
						<spring:message code="label.emailaddress" />
					</form:label>
					<form:input path="strEmail" id="strEmail" size="30" maxlength="100"
						readonly="true" class="t_form-fld-disable" />
				</div>
				<div>
					<form:label path="strMobile">
						<spring:message code="label.mobilenumber" />
					</form:label>
					<form:input path="strMobile" id="strMobile" size="30"
						maxlength="100" readonly="true" class="t_form-fld-disable" />
				</div>
				<div style="display:none;">
					<form:label path="strSmsNotification">
						<spring:message code="label.client.person.register.notifications" />
					</form:label>
					<spring:message code="label.emailnotification" />
					<form:checkbox path="strSmsNotification" value="Y"
						id="strEmailNotification" disabled="true"
						class="t_form-fld-disable opt-input" />
					<spring:message code="label.smsnotification" />
					<form:checkbox path="strEmailNotification" value="Y"
						id="strMobileNotification" disabled="true"
						class="t_form-fld-disable opt-input" />
				</div>
				<div>
					<form:label path="strAccountStatus">
						<span class="t_star">*</span>
						<spring:message code="label.user.status" />
					</form:label>
					<form:input path="strAccountStatus" readonly="true" />
				</div>

			</div>
		</div>
		<fieldset>
			<legend>
				<spring:message code="label.admin.action" />
			</legend>
		</fieldset>		
		<div id="userLockDialog">
			<div class="t_fin-black-txt t_form-left">
				<div>
					<form:label path="actionDate">
						<spring:message code="label.nonclient.person.register.action.date" />
					</form:label>
					<form:input path="actionDate" id="actionDate" size="20"
						maxlength="100" readonly="true" class="t_form-fld-disable" />
				</div>
				<div>
					<form:label path="strActionBy">
						<span class="t_star">*</span>
						<spring:message code="label.nonclient.person.register.action.user" />
					</form:label>
					<form:input path="strActionBy" id="strActionBy" size="20"
						maxlength="100" class="t_form-fld-disable" readonly="true"/>
				</div>
				<div>
					<form:label path="strStatusAction">
						<span class="t_star">*</span>
						<spring:message code="label.lock.unlock" />
					</form:label>
					<form:select path="strStatusAction" items="${adminLockUser}"
						id="strStatusAction" itemLabel="displayLabel" itemValue="id"
						class="fm-opt" />
				</div>
				<div>
					<form:label path="strStatusComments">
						<span class="t_star">*</span>
						<spring:message
							code="label.nonclient.person.register.action.comments" />
					</form:label>
					<form:textarea path="strStatusComments" id="strStatusComments"
						size="20" maxlength="100" class="t_address"/>
				</div>
	
				<div id="fm-submit">
					<input type="submit" name="submit" id="submit"
						value="<spring:message code="label.button.submit" />"
						class="t_btns submit" />
					<input type="reset" name="reset"
						value="<spring:message code="label.button.reset" />" class="t_btns reset" />
				</div>
				<form:hidden path="lUserId" />
				<form:hidden path="strType" />
			</div>
		</div>
	</form:form>
</div>